package mediatheque.controller;

import mediatheque.model.MediathequeModel;
import mediatheque.model.VideoModel;
import mediatheque.view.VideoView;

public class VideoController extends DocumentController {

	public VideoController(MediathequeModel model, final VideoView view) {
		this(model, view, null);		
	}
	
	public VideoController(MediathequeModel model, final VideoView view, VideoModel video) {
		super(model, view, video);
	}

	protected boolean verifierChamps() {
		return (super.verifierChamps() && !((VideoView) view).getValeurDuree().isEmpty());
	}

	protected void enregistrer() {
		if(document == null){
			document = new VideoModel();			
			model.ajouterDocument(document.getIdentifiant(), (VideoModel)document);
		}

		((VideoModel) document).setDuree(((VideoView) view).getValeurDuree());
	
		super.enregistrer();
	}

	
	
}
